﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using jp110311.StorageModels;

namespace MvcWebRole1.Models
{
    public class UserMessagingIndexModel
    {
        public string UserName { get; set; }
        public IEnumerable<UserMessagingEntity> Messages { get; set; }
        public int CurrentPage { get; set; }
        public int TotalMessages { get; set; }
        public string Mode { get; set; }
        public int TotalPages { get; set; }
    }

    public class UserMessagingSendModel
    {
        [Required(ErrorMessage = "タイトルを入力してください。")]
        [DisplayName("タイトル(必須)")]
        public string Title { get; set; }

        [Required(ErrorMessage = "本文を入力してください。")]
        [DisplayName("本文")]
        public string Content { get; set; }

        [Required(ErrorMessage = "宛先を指定してください")]
        [DisplayName("宛先")]
        public string Recipents { get; set; }

        // Controller で埋める
        private readonly List<Address> _addressList = new List<Address>();
        public IList<Address> AddressList
        {
            get
            {
                return _addressList;
            }
        }

        public int AddressBookPageNum { get; set; }

        public int AddressBookMaxPage { get; set; }

        public string Message { get; set; }

        public string ValidationKey { get; set; }

        public string Tag { get; set; }

        public IEnumerable<AddressBookTag> AddressBookTagList { get; set; }

        public string SelectTag { get; set; }
    }

    public class AddressBookTag
    {
        public string Name { get; set; }
        public int Count { get; set; }
    }

    public class ViewMessageModel
    {
        public UserMessagingEntity Message { get; set; }

        public string Mode { get; set; }
    }

    public class AddressBookIndexModel
    {
        public IEnumerable<UserAddressBookEntity> AddressList { get; set; }

        public int TotalCount { get; set; }
        public int CurrentPage { get; set; }
        public int MaxPage { get; set; }
    }

    public class Address
    {
        public string Name { get; set; }
        public bool Selected { get; set; }
    }

    public class UserListQueryModel
    {
        [Required(ErrorMessage = "検索対象の郵便番号を指定してください。")]
        [DisplayName("検索する郵便番号(必須)")]
        public string ZipCode { get; set; }

        [Required(ErrorMessage = "氏名(姓)を入力してください。")]
        [DisplayName("氏名(姓) (必須)")]
        public string FamilyName { get; set; }

        [Required(ErrorMessage = "氏名(名)を入力してください。")]
        [DisplayName("氏名(名) (必須)")]
        public string GivenName { get; set; }

        [DisplayName("誕生日 数字4桁")]
        public string BirthDate { get; set; }

        [DisplayName("登録メモ")]
        public string Memo { get; set; }

        [DisplayName("タグ")]
        public string Tag { get; set; }

        public string QueryResult { get; set; }

        public void Clear()
        {
            ZipCode = null;
            FamilyName = null;
            GivenName = null;
            BirthDate = null;
            Memo = null;
            Tag = null;
        }
    }

    public class TagAddressBookUserModel
    {
        [DisplayName("追加対象ユーザー")]
        public string BookedUser { get; set; }
        [DisplayName("追加するタグ")]
        public string TagList { get; set; }
    }

    public class UserSearchQueryModel
    {
        [Required(ErrorMessage = "検索する地域の郵便番号を指定してください")]
        [DisplayName("郵便番号(必須)")]
        public string ZipCode { get; set; }

        [Required(ErrorMessage = "検索する氏名(姓)を指定してください。")]
        [DisplayName("氏名(姓)(必須)")]
        public string FamilyName { get; set; }

        [Required(ErrorMessage = "検索する氏名(名)を指定してください。")]
        [DisplayName("氏名(名)(必須)")]
        public string GivenName { get; set; }

    }
}